perm filename FIG.MF[MF,DEK] blob sn#600210 filedate 1981-07-15 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00007 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	"Special font for proofmode output"
C00007 00003	new w0 w0=round normwd
C00010 00004	"Dot for defined points"
C00011 00005	"Grey pixels next to a boundary"
C00014 00006	"Grey pixels within a character"
C00015 00007	end
C00016 ENDMK
C⊗;
"Special font for proofmode output";
fontidentifier "FIG"; ptsize=1;
codingscheme "FIG"; texinfo 0,1,1,1,1,1,0;
input cmbase;
if mode=2: highres=1;
else: highres=0;
fi;
if highres>0: designsiz=10 round 6mag;	% printer pixels per MF pixel on Alphatype
	% Alphatype designsize should be a multiple of 10 and at least 40
	dotsize=121mag;	% diameter of design dots on the Alphatype
	minwd=9; normwd=10mag;	% diameter of halftone dots on the Alphatype
	maxwd=11mag;
else: designsiz=round 4mag;	% printer pixels per MF pixel on low-resolution devices
	dotsize=12mag;	% diameter of design dots on low-resolution devices
	minwd=0; normwd=2mag;	% halftone dots on low-resolution devices
	maxwd=4mag;
fi;
pixwd*pixels=designsiz;
magnification pixwd;
new pixels; pixels=designsiz;
hresolution pixels; vresolution pixels;

% The following subroutine is copied from cmbase.mf except for the incx instruction
subroutine charbegin(var charno)	% seven-bit character code
		(var charuw)		% character width in units
	(var lftcorr, var rtcorr)	% sidebar corrections in units
(var charh, var chard, var chari):	% \&{charht}, \&{chardp}, \&{charic} values in points
no eqtrace; no calltrace; no drawdisplay;	% no tracing in this subroutine
new uw,moduw;	% the correct character width in units
new r;	% raster-oriented character width
new u;	% raster-oriented design unit
new tu;	% unmodified raster-oriented unit
new italcorr;	% italic correction
new lcorr,rcorr;	% left and right corrections
if chari≥0: italcorr=chari; else: italcorr=0;
fi;
if danger≠0: % rounding of character width is necessary
	lcorr=danger.round((lftcorr-ls)/danger);
	rcorr=danger.round((rtcorr-ls)/danger);
else: lcorr=lftcorr-ls; rcorr=rtcorr-ls;
fi;
tu=pu.pixels; uw=charuw-(lcorr+rcorr);
if fixwidth=0: moduw=uw;
else: moduw=9; new italcorr; italcorr=0;
fi;
r=charuw.u=round((moduw.tu-2).charuw/uw);
charcode charno; charic italcorr;
if charh>0: charht charh;
else: charht 0;
fi;
if chard>0: chardp chard;
else: chardp 0;
fi;
charwd moduw.pu; chardw moduw.tu;
incx round(-lcorr.u)-.5pixels;
if mode=0: call box(round lcorr.u);
fi.

incx -.5pixels; incy -5.5pixels; % digits and lowercase letters to be offset
ph=7; px=16/22 ph; pe=.5px; pd=2;
pb=1; po=4/220 ph; ps=0; pas=34/220 ph; pa=.5ph;
pw=pwi=pwii=.8; pwiii=36/25 pwii;
pwiv=pwv=.8; aspect=0.9; pdel=10/25 pwii; fudge=.8;
9pu=8; lcs=.5; ucs=1.6; sc=0; ls=0;
slant=0; sqrttwo=sqrt 2; fixwidth=1; crisp=0;
phh=phhh=ph; pssd=0; pdd=.5pd; varg=0; lowast=1; ligs=0.
call fontbegin;
danger=0;
input romand;
input romanl;
incx 0; incy 0;
new w0; w0=round normwd;

subroutine charbegin(var charno, var units):	% for the other characters
charcode charno; charht 1; chardp 0; charwd units; chardw pixels*units.

subroutine halftone(var nw, var ne, var sw, var se):
if highres>0: x3=x7=y7=y8=1/8(designsiz-1);
	x1=x5=y5=y6=3/8(designsiz-1);
	x4=x8=y3=y4=5/8(designsiz-1);
	x2=x6=y1=y2=7/8(designsiz-1);
	crsbreak 1000000;
	cpen; nw draw 1; draw 3;
	ne draw 2; draw 4;
	sw draw 5; draw 7;
	se draw 6; draw 8;
else: cpen; lft0x1=lft0x3=bot0y3=bot0y4=0;
	lft0x2=lft0x4=bot0y1=bot0y2=designsiz/2;
	w0 draw 2; draw 3;
	if nw≤hminwd: draw 1;
	fi;
	if se≥hmaxwd: draw 4;
	fi;
fi.

subroutine repeat: % makes n adjacent copies of normal halftone
if n>0: new nn; nn=n; new n; n=nn-1; incx n*designsiz;
	call halftone(normwd,normwd,normwd,normwd);
	call repeat;
else: incx 0;
fi.

subroutine vertbar:
if highres>0: y8=1/8(designsiz-1);
	x1=x5=y5=3/8(designsiz-1);
	x4=x8=y4=5/8(designsiz-1);
	y1=7/8(designsiz-1);
	crsbreak 1000000;
	cpen; maxwd draw 1; draw 4; draw 5; draw 8;
else: cpen; lft0x0=lft0x1=designsiz/4;
	bot0y0=0; top0y1=designsiz-1;
	w0 draw 0..1;
fi.

subroutine horizbar:
if highres>0: x3=1/8(designsiz-1);
	x5=y5=y6=3/8(designsiz-1);
	x4=y3=y4=5/8(designsiz-1);
	x6=7/8(designsiz-1);
	crsbreak 1000000;
	cpen; maxwd draw 3; draw 4; draw 5; draw 6;
else: cpen; bot0y0=bot0y1=designsiz/4;
	lft0x0=0; rt0x1=designsiz-1;
	w0 draw 0..1;
fi.
"Dot for defined points";
call charbegin('56,1);
cpen; x1=y1=1/2(designsiz-1);
dotsize draw 1.
"Grey pixels next to a boundary";
% Character code '100 + (1,2,4,8) means that there is no grey pixel in the
% direction (N,E,S,W) of this pixel.
% On high resolution devices, this font darkens S/E boundary pixels,
% lightens N/W boundary pixels; on low resolution devices, all boundaries darken.
% When a pixel has no neighbors both to N and S, or both E and W, a bar is
% drawn instead, since this pixel is probably an auxiliary guide line.

hminwd=.5[minwd,normwd]; hmaxwd=.5[maxwd,normwd];

call charbegin('101,1);	% missing N
call halftone(minwd,minwd,hminwd,hminwd).

call charbegin('102,1); % missing E
call halftone(hmaxwd,maxwd,hmaxwd,maxwd).

call charbegin('103,1); % missing N,E
call halftone(minwd,normwd,normwd,maxwd).

call charbegin('104,1);	% missing S
call halftone(hmaxwd,hmaxwd,maxwd,maxwd).

call charbegin('105,1);	% missing N,S
call horizbar.

call charbegin('106,1);	% missing E,S
call halftone(hmaxwd,maxwd,maxwd,maxwd).

call charbegin('107,1);	% missing N,E,S
call horizbar.

call charbegin('110,1); % missing W
call halftone(minwd,hminwd,minwd,hminwd).

call charbegin('111,1);	% missing N,W
call halftone(minwd,minwd,minwd,hminwd).

call charbegin('112,1);	% missing E,W
call vertbar.

call charbegin('113,1);	% missing N,E,W
call vertbar.

call charbegin('114,1);	% missing S,W
call halftone(minwd,normwd,normwd,maxwd).

call charbegin('115,1);	% missing N,S,W
call horizbar.

call charbegin('116,1);	% missing E,S,W
call vertbar.

call charbegin('117,1);	% isolated pixel
call halftone(hminwd,normwd,normwd,hmaxwd).
"Grey pixels within a character";
% For efficiency, the character whose code is '120+k has width 2↑k.
call charbegin('120,1);
new n; n=1; call repeat.

call charbegin('121,2);
new n; n=2; call repeat.

call charbegin('122,4);
new n; n=4; call repeat.

call charbegin('123,8);
new n; n=8; call repeat.

if mode≠2: % these longer characters are too complex for the Alphatype!
	call charbegin('124,16);
	new n; n=16; call repeat;
fi.

if mode≠2:
	call charbegin('125,32);
	new n; n=32; call repeat;
fi.
end